package com.hu.zhcc.shiro.service.HealthIntervention;

import com.github.pagehelper.*;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.dao.FollowupdiaryMapper;
import com.hu.zhcc.shiro.entity.bo.HealthIntervention.Followupdiary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class FollowupdiaryServiceImpl implements FollowupdiaryService {
    @Autowired
    private FollowupdiaryMapper followupdiaryMapper;
    @Override
    public int deleteByPrimaryKey(Integer diaryId) {
        return followupdiaryMapper.deleteByPrimaryKey(diaryId);
    }

    @Override
    public int insertSelective(Followupdiary record) {
        return followupdiaryMapper.insertSelective(record);
    }

    @Override
    public Followupdiary selectByPrimaryKey(Integer diaryId) {
        return followupdiaryMapper.selectByPrimaryKey(diaryId);
    }

    @Override
    public Page<Followupdiary> findByPageList(Map map,int offset, int limit) {
        PageHelper.startPage(offset, limit);
        List<Followupdiary> followupdiaryList = followupdiaryMapper.selectByList(map);
        PageInfo<Followupdiary> info = new PageInfo<>(followupdiaryList);
        return new Page<>(info.getTotal(),followupdiaryList);
    }


    @Override
    public int updateByPrimaryKeySelective(Followupdiary record) {
        return followupdiaryMapper.updateByPrimaryKeySelective(record);
    }
}
